<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

<h:head></h:head>
<h:body>

	<p:message id="growl"></p:message>
	<h:form id="AssuntoListForm">

		<p:panel header="#{message.assuntoTitle}">

			<p:dataTable id="datalist" value="#{beanAssunto.items}" var="item" selectionMode="single" selection="#{beanAssunto.selected}" rowKey="#{item.codAssunto}" paginator="true" rows="10" rowsPerPageTemplate="10,20,30">

				<p:ajax event="rowSelect" update="createButton viewButton editButton deleteButton" />
				<p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton" />

				<p:column sortBy="#{item.codAssunto}" filterBy="#{item.codAssunto}">
					<f:facet name="header">
						<h:outputText value="#{message.assuntoList}" />
					</f:facet>
					<h:outputText value="#{item.codAssunto}" />
				</p:column>
				<p:column sortBy="#{item.assunto}" filterBy="#{item.assunto}">
					<f:facet name="header">
						<h:outputText value="#{message.Assunto}" />
					</f:facet>
					<h:outputText value="#{item.assunto}" />
				</p:column>
				<f:facet name="footer">
					<p:commandButton id="createButton" icon="ui-icon-plus" value="#{message.Create}" actionListener="#{beanAssunto.prepareCreate}" update=":AssuntoCreateForm" oncomplete="AssuntoCreateDialog.show()" />
					<p:commandButton id="viewButton" icon="ui-icon-search" value="#{message.View}" update=":AssuntoViewForm" oncomplete="AssuntoViewDialog.show()" disabled="#{empty beanAssunto.selected}" />
					<p:commandButton id="editButton" icon="ui-icon-pencil" value="#{message.Edit}" update=":AssuntoEditForm" oncomplete="AssuntoEditDialog.show()" disabled="#{empty beanAssunto.selected}" />
					<p:commandButton id="deleteButton" icon="ui-icon-trash" value="#{message.Delete}" actionListener="#{beanAssunto.delete}" update=":growl,datalist" disabled="#{empty beanAssunto.selected}" />
				</f:facet>

			</p:dataTable>

		</p:panel>

	</h:form>

	<p:dialog id="AssuntoViewDlg" widgetVar="AssuntoViewDialog" modal="true" resizable="false" appendToBody="true" header="#{message.ViewAssuntoTitle}">

		<h:form id="AssuntoViewForm">

			<h:panelGroup id="display">
				<p:panelGrid columns="2" rendered="#{beanAssunto.selected != null}">

					<h:outputText value="#{message.AssuntoCod}" />
					<h:outputText value="#{beanAssunto.selected.codAssunto}" title="#{message.AssuntoCod}" />

					<h:outputText value="#{message.Assunto}" />
					<h:outputText value="#{beanAssunto.selected.assunto}" title="#{message.Assunto}" />

					<h:outputText value="#{message.AssutnoListFotografia}" />
				</p:panelGrid>
				<p:commandButton value="#{message.Close}" onclick="AssuntoViewDialog.hide()" />
			</h:panelGroup>

		</h:form>

	</p:dialog>

	<p:dialog id="AssuntoCreateDlg" widgetVar="AssuntoCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{message.AssuntoCreateTitle}">

		<h:form id="AssuntoCreateForm">

			<h:panelGroup id="display">
				<p:panelGrid columns="2" rendered="#{beanAssunto.selected != null}">

					<p:outputLabel value="#{message.Assunto}" for="assunto" />
					<p:inputText id="assunto" value="#{beanAssunto.selected.assunto}" title="#{message.Assunto}" />
				</p:panelGrid>
				<p:commandButton actionListener="#{beanAssunto.create}" value="#{message.Save}" update="display,:AssuntoListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,AssuntoCreateDialog);" />
				<p:commandButton value="#{message.Cancel}" onclick="AssuntoCreateDialog.hide()" />
			</h:panelGroup>

		</h:form>

	</p:dialog>

	<p:dialog id="AssuntoEditDlg" widgetVar="AssuntoEditDialog" modal="true" resizable="false" appendToBody="true" header="#{message.EditAssuntoTitle}">

		<h:form id="AssuntoEditForm">

			<h:panelGroup id="display">
				<p:panelGrid columns="2" rendered="#{beanAssunto.selected != null}">

					<h:outputLabel value="#{message.AssuntoCod}" for="codAssunto" />
					<h:outputText id="codAssunto" value="#{beanAssunto.selected.codAssunto}" />

					<p:outputLabel value="#{message.Assunto}" for="assunto" />
					<p:inputText id="assunto" value="#{beanAssunto.selected.assunto}" title="#{message.Assunto}" />
				</p:panelGrid>
				<p:commandButton actionListener="#{beanAssunto.update}" value="#{message.Save}" update="display,:AssuntoListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,AssuntoEditDialog);" />
				<p:commandButton value="#{message.Cancel}" onclick="AssuntoEditDialog.hide()" />
			</h:panelGroup>

		</h:form>

	</p:dialog>
</h:body>
</html>
